import { reactive } from "vue";
import { getRecommendSongList } from "@/api/index";
import { SongList } from "@/types/index";

export default function useHomeRecommendSongList() {
  let songListTop = reactive<SongList[]>([]);
  let songListBottom = reactive<SongList[]>([]);

  getRecommendSongList(8).then((res) => {
    if (res.code == 200) {
      res.result.forEach((item, index) => {
        if (index < 4) {
          songListTop.push(item);
        } else {
          songListBottom.push(item);
        }
      });
    }
  });

  return { songListTop, songListBottom };
}
